CREATE TABLE IF NOT EXISTS DS.FT_BALANCE_F(
	ON_DATE DATE NOT NULL,
	ACCOUNT_RK NUMERIC NOT NULL,
	CURRENCY_RK NUMERIC,
	BALANCE_OUT FLOAT,
	PRIMARY KEY (ON_DATE, ACCOUNT_RK)
);
CREATE TABLE IF NOT EXISTS DS.FT_POSTING_F(
	OPER_DATE DATE NOT NULL,
	CREDIT_ACCOUNT_RK NUMERIC NOT NULL,
	DEBET_ACCOUNT_RK NUMERIC NOT NULL,
	CREDIT_AMOUNT FLOAT,
	debet_amount FLOAT,
	PRIMARY KEY (OPER_DATE, CREDIT_ACCOUNT_RK, DEBET_ACCOUNT_RK)
);
CREATE TABLE IF NOT EXISTS DS.MD_ACCOUNT_D (
    data_actual_date date not null,
    data_actual_end_date date not null,
    account_rk numeric not null,
    account_number varchar (20) not null,
    char_type varchar (1) not null,
    currency_rk numeric not null,
    currency_code varchar (3) not null,
    primary key (DATA_ACTUAL_DATE, ACCOUNT_RK)
);
CREATE TABLE IF NOT EXISTS DS.MD_CURRENCY_D(
    currency_rk numeric not null,
    data_actual_date date not null,
    data_actual_end_date date,
    currency_code varchar (3),
    code_iso_char varchar (3),
    primary key (CURRENCY_RK, DATA_ACTUAL_DATE)
);
CREATE TABLE IF NOT EXISTS DS.MD_EXCHANGE_RATE_D(
    data_actual_date date not null,
    data_actual_end_date date,
    currency_rk numeric not null,
    reduced_cource float,
    code_iso_num varchar (3),
    primary key (DATA_ACTUAL_DATE, CURRENCY_RK)
);
CREATE TABLE IF NOT EXISTS DS.MD_LEDGER_ACCOUNT_S(
    chapter varchar (1),
    chapter_name varchar (16),
    section_number integer,
    section_name varchar (22),
    subsection_name varchar (21),
    ledger1_account integer,
    ledger1_account_name varchar (47),
    ledger_account integer not null,
    ledger_account_name varchar (153),
    characteristic varchar (1),
    is_resident integer,
    is_reserve integer,
    is_reserved integer,
    is_loan integer,
    is_reserved_assets integer,
    is_overdue integer,
    is_interest integer,
    pair_account varchar (5),
    start_date date not null,
    end_date date,
    is_rub_only integer,
    min_term varchar (1),
    min_term_measure varchar (1),
    max_term varchar (1),
    max_term_measure varchar (1),
    ledger_acc_full_name_translit varchar (1),
    is_revaluation varchar (1),
    is_correct varchar (1),
    primary key (LEDGER_ACCOUNT, START_DATE)
)